#pragma once
#include<string>
#include<iostream>
#include<sstream>

using namespace std;
#define  SEND 0x53
#define  RECV 0x52

typedef unsigned char UCHAR;

#pragma pack(1)
typedef struct _PROTOCOL{
	struct _FrameHeader{
		UCHAR SOF:8;
		UCHAR Datalength:8;
		UCHAR CRC:8;
	}FrameHeader;
	UCHAR FrameTail : 8;
	UCHAR CmdID : 8;
	struct _DATA{
		char *data;
	}DATA;
}PROTOCOL;
#pragma pack()
string protocol_en(UCHAR CmdID, string data);
PROTOCOL protocol_de(string str);
UCHAR crccheck(string str);
bool datacheck(string data);
template<typename T> string toString(const T& t){
	ostringstream oss;
	oss << t;
	return oss.str();
}